package com.bimiaomiao.consumer.dubbo;

import com.bimiaomiao.samples.dubbo.DemoService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.Bean;

/**
 * @description:消费启动类
 * @package com.bimiaomiao.samples.dubbo.service
 * @who MiaoMiao "Sprout" BI
 * @date 2021-02-24 14:04:29
 */
@EnableAutoConfiguration
public class ConsumerApplication {

    private final Logger logger = LoggerFactory.getLogger(getClass());


    @DubboReference(version = "${demo.service.version}")
    private DemoService demoService;

    public static void main(String[] args) {
        SpringApplication.run(ConsumerApplication.class, args);
    }

    @Bean
    public ApplicationRunner runner() {
        String bimiaomiao = demoService.sayHello("bimiaomiao");
        return args -> logger.info(
                demoService.sayHello("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"+bimiaomiao)
        );
    }

}
